<?php

namespace app\applet\controller;

use app\common\model\WxUsers;

class My extends Base
{
    /**
     * @api {GET} /applet/get_user_info 获取用户信息
     * @apiGroup  我的
     * @apiParamExample {json} 参数
     *  {
     *      "token":"123"
     * }
     * @apiSuccessExample {json} 返回
     * {
     *     "code": 1,
     *     "msg": "获取成功",
     *     "data": {
     *          "id":1,                // 用户id
     *         "nickname": "cody",     // 昵称
     *         "headimgurl": "1.png",  // 头像
     *         "score": 0              // 积分
     *     },
     *     "url": "",
     *     "wait": 3
     * }
     */
    public function getUserInfo()
    {
        $info = WxUsers::where(['id' => $this->auth->id])->field('id,nickname,headimgurl,score')->find();
        return $this->success('获取成功', '', $info);
    }

}